import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:get/get.dart';
import 'package:xiaomi_shop/app/modules/shop/controllers/shop_detail_controller.dart';
import 'package:xiaomi_shop/app/services/screenAdapter.dart';

class ShopDetailWebView extends GetView {
  @override
  final ShopDetailController controller = Get.find();

  Function subSegment;

  ShopDetailWebView(this.subSegment, {super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      key: controller.globalKey2,
      width: ScreenAdapter.width(1080),
      child: Column(
        children: [
          subSegment(),
          Obx(() => controller.subSegmentIndex.value == 0
              ? Container(
                  width: ScreenAdapter.width(1080),
                  child: Html(
                    data: controller.shopModel.value.content,
                    style: {
                      "body": Style(backgroundColor: Colors.white),
                      "p": Style(fontSize: FontSize.large)
                    },
                  ),
                )
              : Container(
                  width: ScreenAdapter.width(1080),
                  child: Html(
                    data: controller.shopModel.value.specs,
                    style: {
                      "body": Style(backgroundColor: Colors.white),
                      "p": Style(fontSize: FontSize.large)
                    },
                  ),
                )),
        ],
      ),
    );
  }
}
